﻿using Basic.HrRemoteModel.Holidays;
using Basic.HrRemoteModel.Holidays.Model;
using Basic.HrService.Interface;
using WeDonekRpc.Client.Interface;

namespace Basic.HrService.RpcEvent
{
    internal class HolidaysEvent : IRpcApiService
    {
        private readonly IHolidaysService _Service;
        private readonly ISyncHolidaysService _Sync;

        public HolidaysEvent ( IHolidaysService service, ISyncHolidaysService sync )
        {
            this._Service = service;
            this._Sync = sync;
        }
        public bool SetHolidays ( SetHolidays obj )
        {
            return this._Service.Set(obj.Datum);
        }
        public HolidaysInfo[] GetMonthHolidays ( GetMonthHolidays obj )
        {
            return this._Service.Gets(obj.Year, obj.Month);
        }
        public void RefreshHolidays ()
        {
            this._Sync.Refresh();
        }
    }
}
